#include <stdio.h>

void swap(int* a1, int* a2)
{
    int tmp = *a1;
    *a1 = *a2;
    *a2 = tmp;
}

void sort(int* array, unsigned int nCnt)
{
    int min;

    for (unsigned int i = 0; i < nCnt; ++i)
    {
        min = i;
        for (unsigned int k = i; k < nCnt; ++k)
        {
            if (array[min] > array[k])
                min = k;
        }

        swap(&array[i], &array[min]);
    }
}

int main()
{
    int array[] = { 2,8,5,1,3,11,7,2 };

    sort(array, sizeof(array) / sizeof(int));

    for (unsigned int i = 0; i < (sizeof(array) / sizeof(int)); ++i)
        printf("%d ", array[i]);
    puts("");

    return 0;
}